#!/usr/bin/perl

# $Id$
=head1 COPYRIGHT

Copyright (C) 2008 Longer <longerdev@gmail.com>

=head1 LICENSE

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

=cut

use strict;
use Data::Dumper;

my $dir;
BEGIN{
	$dir = $0;
	$dir =~ s/\/[^\/]+$//;
}
use lib $dir;

use RL::CmdParse;
use RL::Main;

#Enter login & pass
my $login = "";
my $pass = "";

my $cmd = new RL::CmdParse( {"f" => 1, "o" => 1, "c" => 0, "u" => 1} );
$cmd->parse();

my $main = new RL::Main($login, $pass);

if ($cmd->exist("c") && $cmd->exist("o") && defined($cmd->get("o")->[0])){
	$main->setWrMode(2, $cmd->get("o")->[0]);
}
elsif ($cmd->exist("o") && defined($cmd->get("o")->[0])){
	$main->setWrMode(1, $cmd->get("o")->[0]);
}

if ($cmd->exist("f") && defined($cmd->get("f")->[0])){
	$main->fromFile($cmd->get("f")->[0]);
}
elsif($cmd->exist("none")){
	$main->fromCmd($cmd->get("none"));
}
elsif ($cmd->exist("u") && defined($cmd->get("u")->[0])){
	$main->getRLinks($cmd->get("u")->[0]);
}

#print $main->getDirectLink($cmd->get("none")->[0]);
